package com.cr.front.cost.controller;

import com.cr.common.response.JsonResult;
import com.cr.front.cost.pojo.dto.param.CalCostParam;
import com.cr.front.cost.pojo.vo.CostVO;
import com.cr.front.cost.service.CostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@Slf4j
@RestController
@RequestMapping("cost")
@Api(tags = "计价模块")
public class CostController {

    @Autowired
    private CostService costService;
    @ApiOperation("计算短租价格")
    @GetMapping("rent")
    public JsonResult calculateRentCost(CalCostParam costParam){
        CostVO costvo = costService.calculateRentCost(costParam);
        return JsonResult.success(costvo);
    }

    @ApiOperation("计算长租价格")
    @GetMapping("longrent")
    public JsonResult calculateLongRentCost(CalCostParam costParam){
        BigDecimal cost = costService.calculateLongRentCost(costParam);
        return JsonResult.success(cost);
    }


}
